package com.guigu.gulicommon.config;

import com.guigu.gulicommon.context.UserInfoInterceptor;
import lombok.extern.log4j.Log4j2;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 请求拦截器配置类
 *
 * @author 陈俊杰
 * @version 1.0
 * @since 2024/8/15 00:12
 */
@Log4j2
@Configuration
public class WebMvcConfigurerAdaptor implements WebMvcConfigurer {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {     //  拦截器的注册器

        log.info("拦截器初始化中....");
        registry.addInterceptor(new UserInfoInterceptor());
        log.info("拦截器初始化成功完成....");
    }
}
